home *** CD-ROM | disk | FTP | other *** search
/ Aminet 5 / Aminet 5 - March 1995.iso / Aminet / dev / misc / LEDA_gene.lha / LEDA-3.1c-generic / incl / LEDA / node_partition.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-08-05  |  1.3 KB  |  60 lines

  1. /*******************************************************************************
  2. +
  3. +  LEDA  3.1c
  4. +
  5. +
  6. +  node_partition.h
  7. +
  8. +
  9. +  Copyright (c) 1994  by  Max-Planck-Institut fuer Informatik
  10. +  Im Stadtwald, 6600 Saarbruecken, FRG     
  11. +  All rights reserved.
  12. *******************************************************************************/
  13.  
  14.  
  15. #ifndef LEDA_NODE_PARTITION_H
  16. #define LEDA_NODE_PARTITION_H
  17.  
  18. #include <LEDA/graph.h>
  19.  
  20.  
  21.  
  22. //------------------------------------------------------------------------------
  23. // node partitions 
  24. //------------------------------------------------------------------------------
  25.  
  26. #include <LEDA/partition.h>
  27.  
  28. class node_partition : private partition
  29. {
  30.  
  31. public:
  32.  
  33. void init(const graph& G);
  34.  
  35.  node_partition(const graph& G) { init(G); }
  36. ~node_partition()               {}   
  37.  
  38. int  same_block(node v, node w)   
  39. { return partition::same_block(partition_item(v->data[1]),
  40.                                partition_item(w->data[1])); }
  41.  
  42. void union_blocks(node v, node w) 
  43. { partition::union_blocks(partition_item(v->data[1]), 
  44.                           partition_item(w->data[1])); }
  45.  
  46. void make_rep(node v) 
  47. { partition::set_inf(partition_item(v->data[1]),v); }
  48.  
  49. node find(node v) 
  50. { return node(partition::inf(partition::find(partition_item(v->data[1])))); }
  51.  
  52. node operator()(node v) { return find(v); }
  53.  
  54.  
  55. };
  56.  
  57.  
  58. #endif
  59.